<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="../style/journal.css" type="text/css" />
<style type="text/css"><!--
.googleadsense {
	margin: 2px;
	padding: 0px;
//--></style><script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-65008-1";
urchinTracker();
</script><title>job day</title>
</head>
<body>
<a href="index.html">Journal</a>(2005) | <a href="../blog/"><b>Blog</b></a>(2006) | <a href="http://www.fayland.org/cgi-bin/random_link.pl">RandomLink</a> | <a href="AboutFayland.html">WhoAmI</a> | <a href="LiveBookmark.html">LiveBookmark</a> | <a href="http://www.fayland.org/">HomePage</a>
<p><&lt;Previous: <a href="060224.html">another part-time job day</a>&nbsp;&nbsp;>>Next: <a href="sorttable.html">sort table by javascript</a></p>
<h1>job day</h1>
<div class='content'>
<p>Category: <a href='Diary.html'>Diary</a> &nbsp; Keywords: <b>job diary</b></p>It's just another job day.<p />I'm still working at the "ticket" system. It's almost done expect the user authentication part.<p />And my previous work gets online now. Pierre(<a href='http://www.europeanservers.net/'>EuropeanServer</a>) just uploaded this script to <a href='http://www.1001forums.com/cgi-bin/commentaires.pl?langue=2&idfo=8006'>1001forums.com</a>. It's a comment system with "captcha"( <a href="http://search.cpan.org/perldoc?Authen::Captcha">Authen::Captcha</a> ).<p />That's my two paid work.<p />The open-source "<a href="http://sourceforge.net/projects/shellweb">ShellWeb</a>" finally switched from CVS to Subversion. But I'm not deeply involved since the code  is not so clear to me. Get the lastest source from:<br /><pre>svn co https://svn.sourceforge.net/svnroot/shellweb/trunk shellweb</pre>At last, I want to show your another <a href="http://www.template-toolkit.org">TT</a> tooltips I asked today.<p /><h4>TT 小提示</h4><br />我向 templates@template-toolkit.org 邮件组发送了如下这样的问题：<br /><pre>hi, all.<p />in the front of the code ,I create TT instance like this:<p />[snip]<br />use vars qw/$tt/;<br />my $tt = Template->new({ PRE_PROCESS => 'header', POST_PROCESS => 'footer', [snip] };<br />my $q = $query->param('q');<br />[snip]<br />require "$q.pl";<br />[snip]<p />but in one of $q.pl(such as mail.pl, others need the PRE_PROCESS), I don't want the PRE_PROCESS when I call $tt->process<br />is there a way to change *Config Options* after $tt is created? just like $tt->{PRE_PROCESS} = ''; or something else.<br />I don't want to create a new TT instance in this $q.pl(mail.pl) since it's ugly.<p />Thanks for your help. </pre>我的 TT 模版中启用了 PRE_PROCESS 和 POST_PROCESS 参数用于头文件和尾文件。但是程序需要发送一个邮件，而邮件的模版也是一个 tt 文件。但是这个模版不需要头尾文件（因为头文件中包含 HTML 代码，而邮件是纯文本的）。所以就需要暂时性的把 PRE_PROCESS 关闭掉。后来 Sergey Martynoff 在邮件组里回了一个：<br /><pre>For PRE_PROCESS option you can try altering<br />$tt->service->{PRE_PROCESS} (this should work, although I don't<br />think it is a good idea).</pre>总算学到了一招。最后在邮件的发送代码中大致是这样的：<br /><pre>my $body; # email Body<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />######################################3<br />## trick, we don't need the PRE_PROCESS and POST_PROCESS in the mail.tt<br />$tt->service->{PRE_PROCESS}  = [];<br />$tt->service->{POST_PROCESS} = [];<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />$tt->process('mail.tt', $tt_vars, \$body) || die $tt->error();<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /># call the sub to send mail<br />require 'sendmail.pl';<br />$mail_sent = mailer(<br /> &nbsp; &nbsp;To      => $email_to,<br /> &nbsp; &nbsp;From    => $from,<br /> &nbsp; &nbsp;Subject => $subject,<br /> &nbsp; &nbsp;Body    => $body,<br />);</pre>用 $tt->service->{PRE_PROCESS}  = []; 来改变 config 中的 PRE_PROCESS.<br />have fun!</div>
<p><&lt;Previous: <a href="060224.html">another part-time job day</a>&nbsp;&nbsp;>>Next: <a href="sorttable.html">sort table by javascript</a></p>
<p><strong>Options:</strong> <a href='http://del.icio.us/post?title=job%20day&url=http://www.fayland.org/journal/060225.html'>+Del.icio.us</a></p>
<strong>Related items</strong>
<ul><li><a href='060224.html'>another part-time job day</a> < <span class='digit'>2006-02-24 21:12:34</span> ></li><li><a href='041030.html'>Apache2与Sp2冲突</a> < <span class='digit'>2004-10-30 20:33:33</span> ></li><li><a href='050117.html'>Goodbye for a while</a> < <span class='digit'>2005-01-17 15:44:21</span> ></li><li><a href='060218.html'>回到学校</a> < <span class='digit'>2006-02-18 22:56:26</span> ></li></ul>
Created on <span class="digit">2006-02-25 20:27:08</span><br />
Copyright 2004-2006 All Rights Reserved. Powered by <a href="Eplanet.html">Eplanet</a> && <a href='http://catalyst.perl.org'>Catalyst</a> 5.66.
</body>
</html>